package cate.game.role.pvp.minecraft.msg;

import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgOutput;
import cate.game.client.msg.id.MsgIdMinecraft;
import cate.game.role.farm.TimeBasedPlayTimes;
import cate.game.role.pvp.minecraft.po.MinecraftGatherPO;
import easy.java.dev.note.NoteField;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor
@ClientMsg(title = "矿洞争霸-采集区 主要信息 返回")
public class MinecraftMineAreaMainInfoResp implements MsgOutput {
    @NoteField("是否战斗中")
    public boolean fighting;
    @NoteField("历史查看层")
    public int historyLayer;
    @NoteField("今日保护卡使用次数")
    public int protectUsedTime;
    @NoteField("保护结束时间")
    public long protectTime;
    @NoteField("占领AND掠夺次数")
    public TimeBasedPlayTimes playTimes;
    @NoteField(value = "当前占用的圣器列表")
    public List<Integer> usedHallows;
    @NoteField(value = "当前占用的英雄原型ID列表")
    public List<Integer> usedHeroProtoIds;

    @Override
    public MsgConfig conf() {
        return MsgIdMinecraft.MINECRAFT_MINE_AREA_MAIN_INFO_RESP;
    }

    public MinecraftMineAreaMainInfoResp(MinecraftGatherPO info) {
        fighting = info.isFighting();
        historyLayer = info.historyLayer;
        protectUsedTime = info.protectUsedTime;
        protectTime = info.protectTime > System.currentTimeMillis() ? info.protectTime : 0;
        playTimes = info.fightTimes;
        usedHallows = info.usedHallows;
        usedHeroProtoIds = info.usedHeroProtoIds;
    }
}
